package com.ctsi.system.strategy.impl;

import com.ctsi.core.common.exception.MarsException;
import com.ctsi.core.common.util.$;
import com.ctsi.system.enums.SystemExceptionEnum;
import com.ctsi.system.strategy.IDataScope;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @version 1.0
 * @author: wang xiao xiang
 * @date: 2021/8/9 16:18
 */
@Component(IDataScope.DEFINE)
@RequiredArgsConstructor
public class DefineDataScope implements IDataScope {
    @Override
    public List<Long> getOrgIds(List<Long> orgIds, Long userId) {
        if ($.isEmpty(orgIds)) {
            throw new MarsException(SystemExceptionEnum.DEFINE_ORG_NOT_EXIST);
        }
        return orgIds;
    }
}